﻿using System;
using System.IO;
using System.Text;
using Besture.Common;


namespace Besture.UI.Admin.Dialog
{
    public partial class ShowIconDialog : System.Web.UI.Page
    {
        public string _json = string.Empty;
        //当前类别编号
        public string icon = StringHelper.Query("icon");

        protected void Page_Load(object sender, EventArgs e)
        {
            //获取目录下的文件

            string path = Server.MapPath("/Admin/Themes/Icon/");
            DirectoryInfo directoryInfo = new DirectoryInfo(path);
            FileInfo [] fileInfoArgs =  directoryInfo.GetFiles();

            

            StringBuilder Text = new StringBuilder();

            Text.Append("{id:99, pId:0, name: 'NoIcon', icon:'/Admin/Themes/Images/no_ico.jpg'},");

            for (int i = 0; i < fileInfoArgs.Length; i++)
            {
                Text.Append("{id:" + (i + 1) + ", pId:0, name: '" + fileInfoArgs[i].Name + "', icon:'/Admin/Themes/Icon/" + fileInfoArgs[i].Name + "'},");
            }
            _json = string.Format(@"[{0}];", Text.ToString().TrimEnd(',')); 
        }

    }
}